how to find the nth term of a linear sequence